using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class AudioData
{
    public AudioClip clip;
    public float volume;
}

public class AudioManager : Singleton<AudioManager>
{
    [SerializeField] private AudioSource source;
    
    public AudioData brickSFX;

    public const float MIN_PITCH = 0.9f;
    public const float MAX_PITCH = 1.1f;

    protected override void Awake()
    {
        base.Awake();
    }

    public void PlaySFX(AudioData audioData)
    {
        source.PlayOneShot(audioData.clip, audioData.volume);
    }

    public void PlayRandomSFX(AudioData audioData)
    {
        source.pitch = Random.Range(MIN_PITCH, MAX_PITCH);
        PlaySFX(audioData);
    }
}
